<div class="layui-card">
    <div class="layui-card-header">
        <include src="pages/common/breadcrumb.html"/>
    </div>
    <div class="layui-card-body">
        <form method="post" class="layui-form" lay-filter="app-form">
            <div class="layui-row">
                <div class="layui-col-lg8">
                    <div class="ukefu-webim-prop">
                        <div class="ukefu-webim-tl" style="clear:both;">人工坐席接入欢迎消息</div>
                        <div class="box-item">
                            <div class="layui-row">
                                <div class="layui-col-lg12">
                                                        <textarea name="sessionMsg" id="sessionMsg" autocomplete="off"
                                                                  class="layui-input" resize="false"
                                                                  style="height:90px;line-height:22px;resize: none;"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="ukefu-webim-prop">
                        <div class="ukefu-webim-tl" style="clear:both;">无坐席在线提示消息</div>
                        <div class="box-item">
                            <div class="layui-row">
                                <div class="layui-col-lg12">
                                                        <textarea name="noCsMsg" id="noCsMsg" autocomplete="off"
                                                                  class="layui-input" resize="false"
                                                                  style="height:90px;line-height:22px;resize: none;"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="ukefu-webim-prop">
                        <div class="ukefu-webim-tl" style="clear:both;">坐席忙时提示消息（排队位置请使用{num}替换）
                        </div>
                        <div class="box-item">
                            <div class="layui-row">
                                <div class="layui-col-lg12">
                                                        <textarea name="csBusyMsg" id="csBusyMsg"
                                                                  autocomplete="off" class="layui-input" resize="false"
                                                                  style="height:90px;line-height:22px;resize: none;"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="ukefu-webim-prop">
                        <div class="ukefu-webim-tl" style="clear:both;">
                            人工坐席分配成功提示消息（坐席使用{agent}替换）
                        </div>
                        <div class="box-item">
                            <div class="layui-row">
                                <div class="layui-col-lg12">
                                                        <textarea name="successMsg" id="successMsg" autocomplete="off"
                                                                  class="layui-input" resize="false"
                                                                  style="height:90px;line-height:22px;resize: none;"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="ukefu-webim-prop">
                        <div class="ukefu-webim-tl" style="clear:both;">坐席服务结束提示消息</div>
                        <div class="box-item">
                            <div class="layui-row">
                                <div class="layui-col-lg12">
                                                        <textarea name="finishMsg" id="finishMsg" autocomplete="off"
                                                                  class="layui-input" resize="false"
                                                                  style="height:90px;line-height:22px;resize: none;"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="ukefu-webim-prop">
                        <div class="ukefu-webim-tl" style="clear:both;">坐席分配策略</div>
                        <div class="box-item">
                            <div class="layui-row">
                                <div class="layui-col-lg8">
                                    <p>新客户接入人工坐席的分配策略</p>
                                    <p style="color:#888888;font-size:13px;margin-top:10px;">
                                        空闲坐席优先：新客户接入人工坐席的时候，优先分配给对话数量最少的坐席</p>
                                    <p style="color:#888888;font-size:13px;margin-top:10px;">
                                        坐席平均分配：按照坐席轮流分配给未达到最大对话数量的坐席</p>
                                </div>
                                <div class="layui-col-lg4">
                                    <select name="distribution">
                                        <option value="0" selected="selected">空闲坐席优先</option>
                                        <option value="1">坐席平均分配</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="ukefu-webim-prop">
                        <div class="ukefu-webim-tl" style="clear:both;">坐席同时服务最多访客数</div>
                        <div class="box-item">
                            <div class="layui-row">
                                <div class="layui-col-lg8">
                                    <p>为坐席分配的同时服务访客数量的最大限制</p>
                                    <p style="color:#888888;font-size:13px;margin-top:10px;">
                                        分配过多用户会导致客户满意度降低</p>
                                </div>
                                <div class="layui-col-lg4">
                                    <select name="maxUser">
                                        <option value="1">1</option>
                                        <option value="2">2</option>
                                        <option value="3">3</option>
                                        <option value="4">4</option>
                                        <option value="5">5</option>
                                        <option value="10">10</option>
                                        <option value="15">15</option>
                                        <option value="20">20</option>
                                        <option value="30">30</option>
                                        <option value="999">无限制</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="ukefu-webim-prop">
                        <div class="ukefu-webim-tl" style="clear:both;">坐席批量分配最大访客数</div>
                        <div class="box-item">
                            <div class="layui-row">
                                <div class="layui-col-lg8">
                                    <p>单次分配访客的最大数量</p>
                                    <p style="color:#888888;font-size:13px;margin-top:10px;">
                                        为避免坐席就绪的时候突然涌入大量的咨询客户，设置此参数</p>
                                </div>
                                <div class="layui-col-lg4">
                                    <select name="initMaxUser">
                                        <option value="1">1</option>
                                        <option value="2">2</option>
                                        <option value="3">3</option>
                                        <option value="4">4</option>
                                        <option value="5">5</option>
                                        <option value="10">10</option>
                                        <option value="15">15</option>
                                        <option value="20">20</option>
                                        <option value="30">30</option>
                                        <option value="999">无限制</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="ukefu-webim-prop">
                        <div class="ukefu-webim-tl" style="clear:both;">历史服务坐席优先分配</div>
                        <div class="box-item">
                            <div class="layui-row">
                                <div class="layui-col-lg8">
                                    <p>启用此功能后，客户接入坐席的时候，会优先分配一起通话过的坐席进行分配</p>
                                    <p style="color:#888888;font-size:13px;margin-top:10px;">
                                        如果分配的坐席已达到最大服务用户数，则进入等待队列</p>
                                </div>
                                <div class="layui-col-lg4" style="text-align:right;">
                                    <input type="checkbox" name="policyLastCs" title="启用" value="true">
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="ukefu-webim-prop">
                        <div class="ukefu-webim-tl" style="clear:both;">客户超时提醒</div>
                        <div class="box-item">
                            <div class="layui-row">
                                <div class="layui-col-lg8">
                                    <p>客户与坐席对话的超时提醒功能</p>
                                    <p style="color:#888888;font-size:13px;margin-top:10px;">
                                        开启后，用户在指定时间内没有响应时，系统会发送提示消息</p>
                                </div>
                                <div class="layui-col-lg4" style="text-align:right;">
                                    <input type="checkbox" title="启用" name="sessionTimeout" value="true"
                                           lay-filter="sessionTimeout">
                                </div>
                            </div>
                        </div>
                        <div class="box-item" id="sessionTimeout_tip" style="display:none;">
                            <div class="layui-row">
                                <div class="layui-col-lg8">
                                    <p>超时时长（秒）</p>
                                </div>
                                <div class="layui-col-lg4" style="text-align:right;">
                                    <input type="text" name="timeout" id="timeout"
                                           lay-verify="number" autocomplete="off"
                                           class="layui-input" style="width:80px;display:inline;">
                                </div>
                            </div>
                            <div class="layui-row">
                                <div class="layui-col-lg8">
                                    <p>超时提示消息</p>
                                </div>
                            </div>
                            <div class="layui-row" style="margin-top:10px;">
                                <div class="layui-col-lg12">
                                                        <textarea name="timeoutMsg" id="timeoutMsg" autocomplete="off"
                                                                  class="layui-input" resize="false"
                                                                  style="height:90px;line-height:22px;resize: none;"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>


                    <div class="ukefu-webim-prop">
                        <div class="ukefu-webim-tl" style="clear:both;">客户超时提醒后再次超时</div>
                        <div class="box-item">
                            <div class="layui-row">
                                <div class="layui-col-lg8">
                                    <p>客户与坐席对话超时后再次超时后出策略</p>
                                    <p style="color:#888888;font-size:13px;margin-top:10px;">
                                        开启后，用户在指定时间内没有响应时，系统会在2分钟后自动结束对话，</p>
                                </div>
                                <div class="layui-col-lg4" style="text-align:right;">
                                    <input type="checkbox" title="启用" value="true"
                                           name="resessionTimeout" lay-filter="resessionTimeout">
                                </div>
                            </div>
                        </div>
                        <div class="box-item" id="resessionTimeout_tip" style="display:none;">
                            <div class="layui-row">
                                <div class="layui-col-lg8">
                                    <p>提醒后再次超时时长（秒）</p>
                                </div>
                                <div class="layui-col-lg4" style="text-align:right;">
                                    <input type="text" name="retimeout" lay-verify="number"
                                           id="reTimeout" autocomplete="off"
                                           class="layui-input" style="width:80px;display:inline;">
                                </div>
                            </div>
                            <div class="layui-row">
                                <div class="layui-col-lg8">
                                    <p>提醒后再次超时后断开的提示消息</p>
                                </div>
                            </div>
                            <div class="layui-row" style="margin-top:10px;">
                                <div class="layui-col-lg12">
                                                        <textarea name="retimeoutMsg" id="retimeoutMsg"
                                                                  autocomplete="off" class="layui-input" resize="false"
                                                                  style="height:90px;line-height:22px;resize: none;"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="ukefu-webim-prop">
                        <div class="ukefu-webim-tl" style="clear:both;">坐席回复超时</div>
                        <div class="box-item">
                            <div class="layui-row">
                                <div class="layui-col-lg8">
                                    <p>坐席回复客户消息的超时自动回复功能</p>
                                    <p style="color:#888888;font-size:13px;margin-top:10px;">
                                        开启后，坐席在指定时间内没有回复消息时，系统会自动回复用户消息</p>
                                </div>
                                <div class="layui-col-lg4" style="text-align:right;">
                                    <input type="checkbox" title="启用" name="csReplayTimeout"
                                           value="true" lay-filter="csReplayTimeout">
                                </div>
                            </div>
                        </div>
                        <div class="box-item" id="csReplayTimeout_tip" style="display:none;">
                            <div class="layui-row">
                                <div class="layui-col-lg8">
                                    <p>超时时长（秒）</p>
                                </div>
                                <div class="layui-col-lg4" style="text-align:right;">
                                    <input type="text" name="csTimeout" lay-verify="number" autocomplete="off"
                                           class="layui-input" style="width:80px;display:inline;">
                                </div>
                            </div>
                            <div class="layui-row">
                                <div class="layui-col-lg8">
                                    <p>超时提示消息</p>
                                </div>
                            </div>
                            <div class="layui-row" style="margin-top:10px;">
                                <div class="layui-col-lg12">
                                                        <textarea name="csTimeoutMsg" id="csTimeoutMsg"
                                                                  autocomplete="off" class="layui-input" resize="false"
                                                                  style="height:90px;line-height:22px;resize: none;"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="ukefu-webim-prop">
                        <div class="ukefu-webim-tl" style="clear:both;">启用工作时间段设置</div>
                        <div class="box-item">
                            <div class="layui-row">
                                <div class="layui-col-lg8">
                                    <p>非工作时间段提醒功能</p>
                                    <p style="color:#888888;font-size:13px;margin-top:10px;">
                                        开启后，当前时间不在工作时间段内访问将会提示</p>
                                </div>
                                <div class="layui-col-lg4" style="text-align:right;">
                                    <input type="checkbox" title="启用" name="hourCheck"
                                           value="true" lay-filter="hourCheck">
                                </div>
                            </div>
                        </div>
                        <div class="box-item" id="hourCheck_tip" style="display:none;">
                            <div class="layui-row" style="margin-bottom:20px;">
                                <div class="layui-col-lg12">
                                    <p>a、设置工作时间段</p>
                                    <p style="color:#888888;font-size:13px;margin-top:10px;">
                                        只有设置工作时间段之后，留言功能才生效</p>
                                </div>
                            </div>
                            <div class="layui-row" style="margin-bottom:20px;">
                                <div class="layui-col-lg12">
                                    <div id="workhours">

                                    </div>
                                </div>
                            </div>
                            <div class="layui-row" style="margin-bottom:20px;">
                                <div class="layui-col-lg12">
                                    <div class="layui-inline">
                                        <div class="layui-input-inline" style="width: 70px;">
                                            <select id="wh_start_h">
                                                <option value="00">00</option>
                                                <option value="01">01</option>
                                                <option value="02">02</option>
                                                <option value="03">03</option>
                                                <option value="04">04</option>
                                                <option value="05">05</option>
                                                <option value="06">06</option>
                                                <option value="07">07</option>
                                                <option value="08" selected="selected">08</option>
                                                <option value="09">09</option>
                                                <option value="10">10</option>
                                                <option value="11">11</option>
                                                <option value="12">12</option>
                                                <option value="13">13</option>
                                                <option value="14">14</option>
                                                <option value="15">15</option>
                                                <option value="16">16</option>
                                                <option value="17">17</option>
                                                <option value="18">18</option>
                                                <option value="19">19</option>
                                                <option value="20">20</option>
                                                <option value="21">21</option>
                                                <option value="22">22</option>
                                                <option value="23">23</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <div class="layui-input-inline" style="width: 3px;">
                                            :
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <div class="layui-input-inline" style="width: 70px;">
                                            <select id="wh_start_m">
                                                <option value="00">00</option>
                                                <option value="01">01</option>
                                                <option value="02">02</option>
                                                <option value="03">03</option>
                                                <option value="04">04</option>
                                                <option value="05">05</option>
                                                <option value="06">06</option>
                                                <option value="07">07</option>
                                                <option value="08">08</option>
                                                <option value="09">09</option>
                                                <option value="10">10</option>
                                                <option value="11">11</option>
                                                <option value="12">12</option>
                                                <option value="13">13</option>
                                                <option value="14">14</option>
                                                <option value="15">15</option>
                                                <option value="16">16</option>
                                                <option value="17">17</option>
                                                <option value="18">18</option>
                                                <option value="19">19</option>
                                                <option value="20">20</option>
                                                <option value="21">21</option>
                                                <option value="22">22</option>
                                                <option value="23">23</option>
                                                <option value="24">24</option>
                                                <option value="25">25</option>
                                                <option value="26">26</option>
                                                <option value="27">27</option>
                                                <option value="28">28</option>
                                                <option value="29">29</option>
                                                <option value="30" selected="selected">30</option>
                                                <option value="31">31</option>
                                                <option value="32">32</option>
                                                <option value="33">33</option>
                                                <option value="34">34</option>
                                                <option value="35">35</option>
                                                <option value="36">36</option>
                                                <option value="37">37</option>
                                                <option value="38">38</option>
                                                <option value="39">39</option>
                                                <option value="40">40</option>
                                                <option value="41">41</option>
                                                <option value="42">42</option>
                                                <option value="43">43</option>
                                                <option value="44">44</option>
                                                <option value="45">45</option>
                                                <option value="46">46</option>
                                                <option value="47">47</option>
                                                <option value="48">48</option>
                                                <option value="49">49</option>
                                                <option value="50">50</option>
                                                <option value="51">51</option>
                                                <option value="52">52</option>
                                                <option value="53">53</option>
                                                <option value="54">54</option>
                                                <option value="55">55</option>
                                                <option value="56">56</option>
                                                <option value="57">57</option>
                                                <option value="58">58</option>
                                                <option value="59">59</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <div class="layui-input-inline" style="width: 20px;">
                                            ~
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <div class="layui-input-inline" style="width: 70px;">
                                            <select id="wh_end_h">
                                                <option value="00">00</option>
                                                <option value="01">01</option>
                                                <option value="02">02</option>
                                                <option value="03">03</option>
                                                <option value="04">04</option>
                                                <option value="05">05</option>
                                                <option value="06">06</option>
                                                <option value="07">07</option>
                                                <option value="08">08</option>
                                                <option value="09">09</option>
                                                <option value="10">10</option>
                                                <option value="11" selected="selected">11</option>
                                                <option value="12">12</option>
                                                <option value="13">13</option>
                                                <option value="14">14</option>
                                                <option value="15">15</option>
                                                <option value="16">16</option>
                                                <option value="17">17</option>
                                                <option value="18">18</option>
                                                <option value="19">19</option>
                                                <option value="20">20</option>
                                                <option value="21">21</option>
                                                <option value="22">22</option>
                                                <option value="23">23</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <div class="layui-input-inline" style="width: 3px;">
                                            :
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <div class="layui-input-inline" style="width: 70px;">
                                            <select id="wh_end_m">
                                                <option value="00">00</option>
                                                <option value="01">01</option>
                                                <option value="02">02</option>
                                                <option value="03">03</option>
                                                <option value="04">04</option>
                                                <option value="05">05</option>
                                                <option value="06">06</option>
                                                <option value="07">07</option>
                                                <option value="08">08</option>
                                                <option value="09">09</option>
                                                <option value="10">10</option>
                                                <option value="11">11</option>
                                                <option value="12">12</option>
                                                <option value="13">13</option>
                                                <option value="14">14</option>
                                                <option value="15">15</option>
                                                <option value="16">16</option>
                                                <option value="17">17</option>
                                                <option value="18">18</option>
                                                <option value="19">19</option>
                                                <option value="20">20</option>
                                                <option value="21">21</option>
                                                <option value="22">22</option>
                                                <option value="23">23</option>
                                                <option value="24">24</option>
                                                <option value="25">25</option>
                                                <option value="26">26</option>
                                                <option value="27">27</option>
                                                <option value="28">28</option>
                                                <option value="29">29</option>
                                                <option value="30" selected="selected">30</option>
                                                <option value="31">31</option>
                                                <option value="32">32</option>
                                                <option value="33">33</option>
                                                <option value="34">34</option>
                                                <option value="35">35</option>
                                                <option value="36">36</option>
                                                <option value="37">37</option>
                                                <option value="38">38</option>
                                                <option value="39">39</option>
                                                <option value="40">40</option>
                                                <option value="41">41</option>
                                                <option value="42">42</option>
                                                <option value="43">43</option>
                                                <option value="44">44</option>
                                                <option value="45">45</option>
                                                <option value="46">46</option>
                                                <option value="47">47</option>
                                                <option value="48">48</option>
                                                <option value="49">49</option>
                                                <option value="50">50</option>
                                                <option value="51">51</option>
                                                <option value="52">52</option>
                                                <option value="53">53</option>
                                                <option value="54">54</option>
                                                <option value="55">55</option>
                                                <option value="56">56</option>
                                                <option value="57">57</option>
                                                <option value="58">58</option>
                                                <option value="59">59</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <div class="layui-input-inline" style="width: 70px;">
                                            <button class="layui-btn layui-btn-primary"
                                                    type="button" id="wh_time_range"><i
                                                    class="layui-icon"></i></button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row" style="margin-bottom:20px;">
                                <div class="layui-col-lg12">
                                    <p>b、设置非工作时间段的提示信息</p>
                                    <p style="color:#888888;font-size:13px;margin-top:10px;">
                                        在微信渠道下使用或直接打开对话窗口的情况下使用</p>
                                </div>
                            </div>
                            <div class="layui-row">
                                <div class="layui-col-lg12">
                                                        <textarea name="notInWhmsg" autocomplete="off"
                                                                  class="layui-input" resize="false"
                                                                  style="height:90px;line-height:22px;resize: none;">您好，当前非工作时间段。</textarea>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="ukefu-webim-prop">
                        <div class="ukefu-webim-tl" style="clear:both;">排队超时设置</div>
                        <div class="box-item">
                            <div class="layui-row">
                                <div class="layui-col-lg8">
                                    <p>访客的最大排队等待时长</p>
                                    <p style="color:#888888;font-size:13px;margin-top:10px;">
                                        排队时间超过设置的时间后，自动断开访客链接</p>
                                </div>
                                <div class="layui-col-lg4" style="text-align:right;">
                                    <input type="checkbox" title="启用" name="quene" value="true" lay-filter="quene">
                                </div>
                            </div>
                        </div>
                        <div class="box-item" id="quene_tip" style="display:none;">
                            <div class="layui-row">
                                <div class="layui-col-lg8">
                                    <p>排队超时时长（秒）</p>
                                </div>
                                <div class="layui-col-lg4" style="text-align:right;">
                                    <input type="text" name="queneTimeout" id="queneTimeout"
                                           lay-verify="number" value="600" autocomplete="off"
                                           class="layui-input" style="display:inline;">
                                </div>
                            </div>
                            <div class="layui-row" style="margin-top:10px;">
                                <div class="layui-col-lg8">
                                    <p>发送超时提醒消息的系统昵称</p>
                                </div>
                                <div class="layui-col-lg4" style="text-align:right;">
                                    <input type="text" name="serviceName" id="serviceName"
                                           value="系统客服" autocomplete="off" class="layui-input"
                                           style="display:inline;">
                                </div>
                            </div>
                            <div class="layui-row">
                                <div class="layui-col-lg8">
                                    <p>排队超时后断开访客服务请求的提示消息</p>
                                </div>
                            </div>
                            <div class="layui-row" style="margin-top:10px;">
                                <div class="layui-col-lg12">
                                                        <textarea name="queneTimeoutMsg" id="queneTimeoutMsg"
                                                                  autocomplete="off" class="layui-input" resize="false"
                                                                  style="height:90px;line-height:22px;resize: none;">感谢您的咨询，再见！</textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-row">
                <div class="layui-col-lg9 layui-col-lg-offset3">
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit type="button" lay-filter="btn-form-submit">保存</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>

</div>
<style type="text/css">
    .ukefu-webim-tl {
        color: #333333;
        padding: 10px 10px 10px 0;
    }

    .ukefu-webim-prop {
        border-bottom: 1px solid #efefef;
        margin-bottom: 20px;
        padding-bottom: 20px;
    }

    .ukefu-webim-prop {
        padding-left: 10px;
    }

    .ukefu-webim-prop:hover {
        background-color: #f8f8f8;
    }

    .layui-form .box-item {
        padding: 10px 15px 10px 5px;
    }
</style>
<script type="text/javascript">
    layui.use(['tools', 'setter', 'formX', 'admin', 'layer'], function () {
        var tools = layui.tools;
        var form = layui.form;
        var layer = layui.layer;
        var $ = layui.$;
        var $sessionTimeout_tip = $("#sessionTimeout_tip");
        var $resessionTimeout_tip = $("#resessionTimeout_tip");
        var $csReplayTimeout_tip = $("#csReplayTimeout_tip");
        var $hourCheck_tip = $("#hourCheck_tip");
        var $quene_tip = $("#quene_tip");
        var working_tpl = '<small id="wh_{0}" class="ukefu-timerange layui-btn layui-btn-normal">{1} <i class="layui-icon">ဆ</i> <input type="hidden" name="workingHours" value="{2}"> </small>';
        var methods = {
            checkEvent: function () {
                form.on('checkbox(sessionTimeout)', function (data) {
                    $sessionTimeout_tip.css("display", data.elem.checked ? 'block' : 'none');
                });
                form.on('checkbox(resessionTimeout)', function (data) {
                    $resessionTimeout_tip.css("display", data.elem.checked ? 'block' : 'none');
                });
                form.on('checkbox(csReplayTimeout)', function (data) {
                    $csReplayTimeout_tip.css("display", data.elem.checked ? 'block' : 'none');
                });
                form.on('checkbox(hourCheck)', function (data) {
                    $hourCheck_tip.css("display", data.elem.checked ? 'block' : 'none');
                });
                form.on('checkbox(quene)', function (data) {
                    $quene_tip.css("display", data.elem.checked ? 'block' : 'none');
                });
            },

            whTimeRangeEvent: function () {
                var $whours = $("#workhours");
                $("#wh_time_range").click(function () {
                    var wh_start_h = $("#wh_start_h").val();
                    var wh_start_m = $("#wh_start_m").val();
                    var wh_end_h = $("#wh_end_h").val();
                    var wh_end_m = $("#wh_end_m").val();
                    var wtime = wh_start_h + ":" + wh_start_m + "~" + wh_end_h + ":" + wh_end_m;
                    if (document.getElementById('wh_' + wtime) == null) {
                        $whours.append(tools.format(working_tpl, wtime, wtime, wtime));
                    }

                })
            },

            whTimeDelEvent: function () {
                $("#workhours").on('click', '.ukefu-timerange', function () {
                    $(this).remove();
                });
            },

            getSessionConfig: function () {
                tools.request({
                    url: '/plm/api/im/csSession/config/getConfig'
                }).done(function (res) {
                    if (res.code == 0 && res.data) {
                        form.val('app-form', res.data);
                        var d = res.data;
                        if (d.sessionTimeout) {
                            $("#sessionTimeout_tip").show();
                        }
                        if (d.resessionTimeout) {
                            $resessionTimeout_tip.show();
                        }
                        if (d.csReplayTimeout) {
                            $csReplayTimeout_tip.show();
                        }
                        if (d.hourCheck) {
                            $hourCheck_tip.show();
                            var $whours = $("#workhours");
                            var wtimes = (d.workingHours + '').split(",");
                            $.each(wtimes, function (i, wtime) {
                                if (wtime && document.getElementById('wh_' + wtime) == null) {
                                    $whours.append(tools.format(working_tpl, wtime, wtime, wtime));
                                }
                            })
                        }
                        if (d.quene) {
                            $quene_tip.show();
                        }
                    } else {
                        if(!res.data){
                            layer.msg('查询失败', {
                                icon: 5
                            });
                        }else{
                            layer.msg(res.msg, {
                                icon: 5
                            });
                        }

                    }
                })

            },

            doSubmit: function () {
                //表单提交事件
                form.on('submit(btn-form-submit)', function (data) {
                    var params = data.field;
                    var workingHours = "";
                    $("input[name=workingHours]").each(function () {
                        workingHours += $(this).val() + ",";
                    })
                    params.workingHours = workingHours;
                    tools.request({
                        url: '/plm/api/im/csSession/config/saveOrUpdate',
                        params: params,
                        method: "post"
                    }).done(function (res) {
                        if (res.code == 0) {
                            layer.msg(res.msg, {
                                icon: 1
                            });
                        } else {
                            layer.msg(res.msg, {
                                icon: 5
                            });
                        }
                    })
                    return false;
                });
            }

        };
        tools.includeHtml(function (p) {
            $(this).vm({"headerTitle": "对话设置"});
        })
        methods.checkEvent();
        methods.whTimeRangeEvent();
        methods.whTimeDelEvent();
        methods.doSubmit();
        methods.getSessionConfig();
    });
</script>